import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/l10n.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/widgets/button/normal_button.dart';
import 'package:flutter/material.dart';

import 'default_bottom_sheet.dart';

showPayAnotherCardBeforeRemovingTipBottomSheet(BuildContext context, {VoidCallback onSeeInvoice}) => showGotItTipBottomSheet(
      context,
      S.current.please_set_payment_method_to_another_card_before_removing,
    );

showPaySubSuccess(BuildContext context, {VoidCallback onSeeInvoice}) =>
    showGotItTipBottomSheet(context, S.current.your_payment__has_been_completed, onGotIt: onSeeInvoice, gotBtnText: S.current.see_invoice);

showReconciliationSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.reconciliation_has_been_reversed_succesfully, onGotIt: onGotIt);

showUpdateBalancesSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_balances_has_been_updated_successfully, onGotIt: onGotIt);

showClosedFinancialYearTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_current_financial_year_has_been_closed_successfully, onGotIt: onGotIt);

/// 删除 fixed asset 成功
showDeleteFixedAssetSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_fixed_asset_has_been_deleted_successfully, onGotIt: onGotIt);

///
showDeleteUnitTypeSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_uom_has_been_deleted_successfully, onGotIt: onGotIt);

///
showMarkedAsDeliveredSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_items_have_been__marked_as_delivered, onGotIt: onGotIt);

/// 登录信息更改成功
showLoginDetailUpdateSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.login_details_have_been_updated_successfully, onGotIt: onGotIt);

/// 更新信息成功
showInformationUpdateSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.information_has_been_updated_successfully, onGotIt: onGotIt);
////提示成功
showSuccessTipBottomSheet(BuildContext context, String tip, {VoidCallback onGotIt}) => showGotItTipBottomSheet(context, tip, onGotIt: onGotIt);

//tax payable recorded
showTaxPayableRecordedTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.your_tax_payable_has_been_recorded_in_the_balance_sheet, onGotIt: onGotIt);

/// 请保存
showTotalDebitEqualsTotalTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.please_ensure_that_total_debit_equals_to_total_credit_amount, onGotIt: onGotIt);

/// 支付进度
showPaymentProcessedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.your_payment_has_been_processed, onGotIt: onGotIt, gotBtnText: S.current.see_invoice);

/// 更改当前设置的支付方式
showPaymentMethodUpdateSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.payment_method_has_been_updated_successfully, onGotIt: onGotIt);

/// 移除当前设置的支付方式
showPaymentMethodSetRemoveSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.please_set_payment_method_to_another_card_before_removing, onGotIt: onGotIt);

/// 移除支付方式
showPaymentMethodRemoveSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.payment_method_has_been_removed_successfully, onGotIt: onGotIt);

/// 移除邀请人成功
showInvitationDisableSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_team_member_has_been_disabled_successfully, onGotIt: onGotIt);

/// 移除邀请人成功
showInvitationRemovedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.invitation_for_the_selected_member_has_been_removed, onGotIt: onGotIt);

/// 邀请已发送到邮箱
showInvitationSendSmsSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.invitation_has_been_sent_via_sms_to_their_phone_number, onGotIt: onGotIt);

/// 拒绝费用报销成功
showExpenseRejectedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_expense_claim_has_been_marked_as_rejected, onGotIt: onGotIt);

/// 批准费用报销成功
showExpenseClaimSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_expense_claim_has_been_marked_as_approved, onGotIt: onGotIt);

/// 拒绝假期成功
showLeaveRejectedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_leave_has_been_marked_as_rejected, onGotIt: onGotIt);

/// 批准假期成功
showLeaveApprovedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_leave_has_been_marked_as_approved, onGotIt: onGotIt);

/// 取消假期成功
showLeaveWithdrawSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_leave_has_been_withdrawn_successfully, onGotIt: onGotIt);

/// 删除假期成功
showLeaveDeleteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_leave_has_been_deleted_successfully, onGotIt: onGotIt);

/// 调整假期成功
showLeaveAdjustedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_leave_has_been_adjusted_accordingly, onGotIt: onGotIt);

/// 支付payment成功
showPayslipsMarkedAsPaidBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_payslips_have_been_marked_as_paid, onGotIt: onGotIt);

/// 请求工资单成功
showPayslipsRunRequestSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.payroll_run_request_has_been_submitted, onGotIt: onGotIt);

/// 删除未付款订单成功
showPayslipsDeleteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_payslip_has_been_deleted_successfully, onGotIt: onGotIt);

/// 解雇某个员工成功
showEmployeeMarkResignedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_employee_has_been_marked_as_resigned, onGotIt: onGotIt);

/// 删除账号成功
showAccountDeleteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_account_has_been_deleted_successfully, onGotIt: onGotIt);

/// 删除journal entry成功
showJournalEntryDeleteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_general_journal_has_been_deleted_successfully, onGotIt: onGotIt);

/// 删除联系人有交易订单
showContactDueLinkedTransactionBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.contact_cannot_be_deleted__due_to_linked_transactions, onGotIt: onGotIt);

/// 删除联系人成功
showContactPersonSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_contact_person_has_been_deleted_successfully, onGotIt: onGotIt);

/// 删除coa成功
showCoaSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_subaccount_has_been_deleted_successfully, onGotIt: onGotIt);

/// 删除联系人成功
showContactSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_contact_has_been_deleted_successfully, onGotIt: onGotIt);

/// 更改库存
showAdjustedInventorySuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_inventory_will__be_adjusted_accordingly, onGotIt: onGotIt);

/// 删除产品成功
showProductDeleteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_product_has_been_deleted_successfully, onGotIt: onGotIt);

/// 禁用产品成功
showProductDeActivatedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_product_has_been_deactivated_successfully, onGotIt: onGotIt);

/// 激活产品成功
showProductActivatedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_product_has_been_activated_successfully, onGotIt: onGotIt);

/// 删除服务成功
showServiceDeleteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_service_has_been_deleted_successfully, onGotIt: onGotIt);

/// 禁用服务成功
showServiceDeActivatedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_service_has_been_deactivated_successfully, onGotIt: onGotIt);

/// 激活服务成功
showServiceActivatedSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_service_has_been_activated_successfully, onGotIt: onGotIt);

/// 删除 credit note 成功
showDeleteCreditNoteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_credit_note_has_been_deleted_successfully, onGotIt: onGotIt);

//删除 debit note
showDeleteDebitNoteSuccessBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_debit_note_has_been_deleted_successfully, onGotIt: onGotIt);

// marked as rejected success
showQuotationMarkedAsRejectedSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_quotation_has_been_marked_as_rejected, onGotIt: onGotIt);

// marked as rejected success
showMarkedAsRejectedSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_amount_has_been_credited_to_merchants_account, onGotIt: onGotIt);

// keep as credit
showKeepAsCreditSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_amount_has_been_credited_to_merchants_account, onGotIt: onGotIt);

// debit keep as credit
showDebitKeepAsCreditSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_amount_has_been_credited_to_your_account, onGotIt: onGotIt);

showExpenseDeleteSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_expense_claim_has_been_deleted_successfully, onGotIt: onGotIt);

showExpenseWithdrawSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_expense_claim_has_been_updated_successfully, onGotIt: onGotIt);

showRejectedTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_expense_claim_has_been_marked_as_rejected, onGotIt: onGotIt);

showReimbursementTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_reimbursement_will_be_added_to_employees_payslip, onGotIt: onGotIt);

showDeleteSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_transaction_has_been_deleted_successfully, onGotIt: onGotIt);

showCreateRoleSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.new_role_has_been_created_successfully, onGotIt: onGotIt);

showDeleteRoleSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.selected_role_has_been_deleted_successfully, onGotIt: onGotIt);

showUnableDeleteRoleTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.unable_to_delete_as_current_role_is_currently_in_use, onGotIt: onGotIt);

showEditRoleSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.the_changes_have_been_applied_successfully, onGotIt: onGotIt);

showBatchAssignRoleSuccessTipBottomSheet(BuildContext context, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.role_has_been_assigned_to_selected_team_members, onGotIt: onGotIt);

showSwitchFinancialYearSuccessTipBottomSheet(BuildContext context, String date, {VoidCallback onGotIt}) =>
    showGotItTipBottomSheet(context, S.current.you_have_switched_the_fy_to_date(date), onGotIt: onGotIt);

/// rejected
showGotItTipBottomSheet(BuildContext context, String content, {String title, VoidCallback onGotIt, String gotBtnText}) => showDefaultBottomSheet(
      context,
      child: _GotItTipWidget(
        onGotIt: onGotIt,
        content: content,
        gotBtnText: gotBtnText,
      ),
      title: title,
      isScrollControlled: true,
    );

showNoPermission(BuildContext context, {VoidCallback onSeeInvoice}) => showGotItTipBottomSheet(
      context,
      S.current.you_dont_have_permission_to_visit_this_page,
    );

class _GotItTipWidget extends StatelessWidget {
  final VoidCallback onGotIt;
  final String content;
  final String gotBtnText;

  const _GotItTipWidget({Key key, this.onGotIt, this.content, this.gotBtnText}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final titleStyle = TextStyle(
      color: aceBlackColor,
      fontSize: getSp(22),
      fontWeight: FontWeight.w700,
      height: 24 / 22,
    );
    return Padding(
      padding: EdgeInsets.only(
        left: getDp(36),
        right: getDp(36),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Text(
            content,
            style: titleStyle,
            textAlign: TextAlign.center,
          ),
          SizedBox(
            height: getDp(30),
          ),
          NormalButton(
            onTap: onGotIt ??
                () {
                  Navigator.of(context).pop();
                },
            title: gotBtnText ?? S.current.got_it,
          ),
        ],
      ),
    );
  }
}
